import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Iterator;

public class FindMyXmindFile {
    public static void main(String[] args) {
        File diskDTreeFile = new File("G:\\");
        File tempFile;
        ArrayList<File> fileArray = new ArrayList<>();
        ArrayList<File> directoryArray = new ArrayList<>();
        File[] basic = diskDTreeFile.listFiles();
        for (File file : basic) {
            if (file.isFile())
                fileArray.add(file);
            else if (file.isDirectory()) {
                directoryArray.add(file);
            }
        }
        Iterator<File> iterator = fileArray.iterator();
        while (iterator.hasNext()) {
            tempFile = iterator.next();
            if (tempFile.getName().endsWith(".xmind")) {
                System.out.println(tempFile.getAbsolutePath());
            }
        }

        Iterator<File> iterator1 = directoryArray.iterator();
        while (iterator1.hasNext()) {
            tempFile = iterator1.next();
            if(tempFile.isDirectory())
            func(tempFile);
            else{
                if(tempFile.getName().endsWith(".xmind"))
                    System.out.println(tempFile.getAbsolutePath());
            }
        }


    }

    public static void func(File tempFile) {
        //对于每一个文件来说
        File[] files = tempFile.listFiles();
        if(files==null)
            return;
        for (File file : files) {
            if (file.isDirectory()) {
                func(file);
            } else if (file.isFile()) {
                if (file.getName().endsWith(".xmind")) {
                    System.out.println(file.getAbsolutePath());
                }
            }
        }
    }
}
